home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Human Interface Toolbox / Concordia / Concordia.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  3.6 KB  |  110 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        Concordia.c
  3.  
  4.     Contains:    the entry point to the concordia MDEF at the function
  5.                 called main.  This file also contains two routines, GetTextState and
  6.                 SetTextState, that didn't really seem to fit categorically in any other source
  7.                 file (they should really have been in ROM, like Get- and SetPenState!).
  8.  
  9.     Written by:     
  10.  
  11.     Copyright:    Copyright © 1999 by Apple Computer, Inc., All Rights Reserved.
  12.  
  13.                 You may incorporate this Apple sample source code into your program(s) without
  14.                 restriction. This Apple sample source code has been provided "AS IS" and the
  15.                 responsibility for its operation is yours. You are not permitted to redistribute
  16.                 this Apple sample source code as "Apple sample source code" after having made
  17.                 changes. If you're going to re-distribute the source, we require that you make
  18.                 it clear in the source that the code was descended from Apple sample source
  19.                 code, but that you've made changes.
  20.  
  21.     Change History (most recent first):
  22.                 8/10/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  23.                 
  24.  
  25. */
  26.  
  27.  
  28. /******************************************************************************\
  29. * Header Files
  30. \******************************************************************************/
  31.  
  32. #include <Menus.h>
  33. #include <Quickdraw.h>
  34. #include <Types.h>
  35. #include "ChooseTkl.h"
  36. #include "Concordia.h"
  37. #include "DrawTkl.h"
  38. #include "PopUpTkl.h"
  39. #include "SizeTkl.h"
  40.  
  41.  
  42. /******************************************************************************\
  43. * Function Prototypes
  44. \******************************************************************************/
  45.  
  46. pascal void main (short, MenuHandle, Rect *, Point, short *);
  47.  
  48.  
  49. #pragma segment Main
  50. /******************************************************************************\
  51. * main - Entry point for the Concordia MDEF
  52. \******************************************************************************/
  53.  
  54. pascal void
  55. main (short Message,MenuHandle TheMenu,Rect* MenuRect,Point HitPt,short* WhichItem)
  56. {
  57.     if (Message == mDrawMsg)
  58.         DoDrawMsg (TheMenu, MenuRect);
  59.     else if (Message == mChooseMsg)
  60.         *WhichItem = DoChooseMsg (TheMenu, MenuRect, HitPt, *WhichItem);
  61.     else if (Message == mSizeMsg)
  62.         DoSizeMsg (TheMenu);
  63.     else if (Message == mPopUpMsg)
  64.         *WhichItem = DoPopUpMsg (TheMenu, MenuRect, HitPt.h, HitPt.v,
  65.                 *WhichItem);
  66.     }
  67.  
  68.  
  69. #pragma segment Main
  70. /******************************************************************************\
  71. * GetTextState - Get the current state of text
  72. *
  73. * GetTextState gets the typeface, typestyle, typesize, and drawing mode of the
  74. * current font of the current GrafPort and places this information in the
  75. * TextStateRec specified by TextInfo.
  76. \******************************************************************************/
  77.  
  78. void
  79. GetTextState (TextInfo)
  80.     TextStateRec *TextInfo; //-> Text state info <<
  81.     {
  82.     GrafPtr CurrPort; //-> Current graphics port
  83.  
  84.     GetPort (&CurrPort);
  85.     TextInfo->txFace = CurrPort->txFont;
  86.     TextInfo->txStyle = CurrPort->txFace;
  87.     TextInfo->txMode = CurrPort->txMode;
  88.     TextInfo->txSize = CurrPort->txSize;
  89.     }
  90.  
  91.  
  92. #pragma segment Main
  93. /******************************************************************************\
  94. * SetTextState - Set the current state of text
  95. *
  96. * SetTextState gets the typeface, typestyle, typesize, and drawing mode of the
  97. * current font of the current GrafPort and places this information in the
  98. * TextStateRec specified by TextInfo.
  99. \******************************************************************************/
  100.  
  101. void
  102. SetTextState (TextInfo)
  103.     TextStateRec *TextInfo; //-> Text state info >>
  104.     {
  105.     TextFont (TextInfo->txFace);
  106.     TextFace (TextInfo->txStyle);
  107.     TextMode (TextInfo->txMode);
  108.     TextSize (TextInfo->txSize);
  109.     }
  110.